/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package defensive_practice_trw;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTextField;

/**
 *
 * @author rockero
 */
public class Defensive_Practice_TRW {
    static int nHabi;
    static int cuotaHabi;
    static int nClientes;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)  {
        
        try{
        FileReader fr = new FileReader("clientes.txt");
        BufferedReader bf = new BufferedReader(fr);
        
         nClientes= getNumberClientesTxt(bf);
        if(nClientes==0) {
            EmptyList listaVacia=new EmptyList();
            listaVacia.setVisible(true);
            
        }
        
        else{
        MainFrame principal = new MainFrame ();
        principal.setVisible(true);
        
       
        }
        }
         catch (Exception e){
             FileNotFoundFrame alerta1= new FileNotFoundFrame ();
             alerta1.setVisible(true);
            
         }
        
       System.out.println("archivo encontrado"); 
       
      
       
                  
        
    }
    
    static public int getNumberClientesTxt(BufferedReader bf){
        int count=0;
        try {
            while ((bf.readLine())!=null) {
                count++;
                    }
        } catch (IOException ex) {
            ErrorReadLine alerta2=new ErrorReadLine ();
            alerta2.setVisible(true);
        }
        return count;
    }
    
}
